package ai.yue.open.service.cd.controller;

import ai.yue.library.base.annotation.ApiVersion;
import ai.yue.library.base.view.Result;
import ai.yue.open.service.cd.service.WorkloadRedeployLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 工作负载部署日志
 *
 * @author yl-yue
 * @since  2023/2/14
 */
@ApiVersion
@RequiredArgsConstructor
@RestController
@RequestMapping("/auth/{version}/workloadRedeployLog")
public class WorkloadRedeployLogController {

    final WorkloadRedeployLogService workloadRedeployLogService;

    @DeleteMapping("/deleteById")
    public Result<?> deleteById(Long id) {
        return workloadRedeployLogService.deleteById(id);
    }

    @DeleteMapping("/deleteByIds")
    public Result<?> deleteByIds(List<Long> ids) {
        return workloadRedeployLogService.deleteByIds(ids);
    }

    @GetMapping("/page")
    public Result<?> page() {
        // 前端需要传规范的分页参数，框架会自动从request中获取
        return workloadRedeployLogService.page();
    }

}
